package main.java.IO;

import java.io.*;

/*
    对象流应用
 */
public class ObjectOutputStreamDemo {
    public static void main(String[] args) throws CloneNotSupportedException, IOException {
        //构建流对象
        Massage m = new Massage(1,"标题","内容");
        ObjectOutputStream oos =
                new ObjectOutputStream
                        (new FileOutputStream("Message.txt"));
        //写对象（序列化）
        oos.writeObject(m);
        System.out.println("序列化成功");
        //关闭流对象
        oos.close();
    }
}
